# 页面类
from selenium.webdriver.common.by import By
from rk_lianxi.rk_11.Base import Base
from time import sleep

class Page(Base):
    # 定位器
    login_loc = (By.LINK_TEXT,'登录')
    username_loc = (By.NAME,'username')
    password_loc = (By.NAME,'password')
    login_btn_loc = (By.CLASS_NAME,'finish-btn')
    search_loc = (By.XPATH,'//*[@id="searchForm"]/div[1]/input')

    # 封装方法
    # 点击登录
    def login(self):
        self.click(self.login_loc)
    # 输入账号密码
    def login_caozuo(self):
        self.send_keys(self.username_loc,'18238680385')
        self.send_keys(self.password_loc,'123456')
    # 点击登录按钮
    def login_btn(self):
        self.click(self.login_btn_loc)
    # 搜索框输入内容
    def search(self):
        self.keys_Enter(self.search_loc,'狗')

    # 业务逻辑
    def test_A3mall_luoji1(self):
        self.login()
        sleep(1)
        self.login_caozuo()
        sleep(6)
        self.login_btn()
        sleep(5)
        self.search()
